package com.nbsaas.boot.common.rest.resource;

import com.nbsaas.boot.common.api.apis.DataTypeApi;
import com.nbsaas.boot.common.data.entity.DataType;
import com.nbsaas.boot.common.api.domain.request.DataTypeRequest;
import com.nbsaas.boot.common.api.domain.response.DataTypeResponse;
import com.nbsaas.boot.common.api.domain.simple.DataTypeSimple;
import com.nbsaas.boot.common.rest.convert.DataTypeSimpleConvert;
import com.nbsaas.boot.common.rest.convert.DataTypeEntityConvert;
import com.nbsaas.boot.common.rest.convert.DataTypeResponseConvert;
import com.nbsaas.boot.common.data.repository.DataTypeRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   业务接口实现
*/
@Transactional
@Service
public class DataTypeResource extends BaseResource<DataType,DataTypeResponse, DataTypeSimple, DataTypeRequest>  implements DataTypeApi {

    @Resource
    private DataTypeRepository dataTypeRepository;

    @Override
    public JpaRepositoryImplementation<DataType, Serializable> getJpaRepository() {
        return dataTypeRepository;
    }

    @Override
    public Function<DataType, DataTypeSimple> getConvertSimple() {
        return new DataTypeSimpleConvert();
    }

    @Override
    public Function<DataTypeRequest, DataType> getConvertForm() {
        return new DataTypeEntityConvert();
    }

    @Override
    public Function<DataType, DataTypeResponse> getConvertResponse() {
        return new DataTypeResponseConvert();
    }




}


